package com.example.phone.account.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.phone.R;
import com.example.phone.base.RequestInterface;
import com.example.phone.bean.Order;
import com.example.phone.bean.OrderItem;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018\12\30 0030.
 */

public class OrderRecycleAdapter extends RecyclerView.Adapter<OrderRecycleAdapter.ViewHolder> {
    List<Order> orders;
    Context context;
    RecyclerView.Adapter adapter;



    public static class ViewHolder extends RecyclerView.ViewHolder {



        @BindView(R.id.recylerView_product)
        RecyclerView recylerView_product;


        public ViewHolder(View view) {

            super(view);
            ButterKnife.bind(this,view);

        }


    }

    public OrderRecycleAdapter(Context context, List<Order> orders) {
        this.orders = orders;
        this.context = context;
    }


    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_wait_paying, parent, false);
        ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        Order order = orders.get(position);
        LinearLayoutManager layoutManager = new LinearLayoutManager(context);
        holder.recylerView_product.setLayoutManager(layoutManager);
        adapter = new ProductRecycleAdapter(context, order);

        holder.recylerView_product.setAdapter(adapter);




    }

    @Override
    public int getItemCount() {
        return orders.size();
    }
}
